<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        $(function (){
            $.ajax({
                url:"userList.do",
                type:"post",
                dataType:"json",
                success:function (obj){
                    for (var i in obj) {
                        $("[name='uid']").append(" <option value="+obj[i].uid+">"+obj[i].uname+"</option>")
                    }
                }
            })
            $.ajax({
                url:"floorList.do",
                type:"post",
                dataType:"json",
                success:function (obj){
                    for (var i in obj) {
                        $("[name='fid']").append(" <option value="+obj[i].fid+">"+obj[i].fname+"</option>")
                    }
                }
            })
            $("[name='fid']").change(function (){
                $("[name='did']").empty()
                $("[name='did']").append("<option value=''>请选择</option>")
                var fid=$(this).val();
                $.ajax({
                    url:"dorList.do",
                    data:{"fid":fid},
                    type:"post",
                    dataType:"json",
                    success:function (obj){
                        for (var i in obj) {
                            $("[name='did']").append(" <option value="+obj[i].did+">"+obj[i].dname+"</option>")
                        }
                    }
                })
            })

            $("[name='did']").change(function (){
                var did=$(this).val();
                $.ajax({
                    url:"valid.do",
                    data:{"did":did},
                    type:"post",
                    dataType:"json",
                    success:function (obj){
                      $("#num").text(obj.unum);
                      if(obj.unames==''||obj.unames==null){
                          $("#users").text("");
                      }else{
                          $("#users").text(obj.unames);

                      }

                      if(obj.unum>=4){
                          $("#sb").prop("disabled" ,true)
                      }else{
                          $("#sb").prop("disabled" ,false)
                      }
                    }
                })
            })
        })
    </script>
</head>
<body>
    <form action="change.do" method="post">
·
        当前人数：<span id="num"></span><br>
        当前详情：<span id="users"></span><br>
        <input type="submit" id="sb" value="调整" ><br>
    </form>

</body>
</html>